﻿using AuthorityManagement.Controllers;
using AuthorityManagement.Helper;
using AuthorityManagement.Model;
using AutoMapper;
using Newtonsoft.Json;
using System.IO;

namespace AuthorityManagement.AutoMapper
{
    /// <summary>
    /// automapper实现映射
    /// </summary>
    public class TestMapperProfile:Profile
    {
        //public TestMapperProfile()
        //{
        //    CreateMap<User, Test>();
        //    CreateMap<Test, User>();
        //}

        public TestMapperProfile()
        {
            CreateMap<Test, User>()
               .ForMember(d => d.Id, dst => dst.MapFrom(s => s.id))
           .ForMember(d => d.UserName, dst => dst.MapFrom(s => s.name));
        }
        //public TestMapperProfile()
        //{
        //    CreateMap<Process, Test>()
        //   .ForMember(d => d.fileInfo,p=> p.MapFrom(p=> JsonConvert.DeserializeObject<FileMode>(p.fileInfo.ToString())));
        //    CreateMap<Test, Process>()
        //   .ForMember(d => d.fileInfo, p => p.MapFrom(p => JsonConvert.DeserializeObject<FileMode>(p.fileInfo.ToString())));
        //}
    }
}
